<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<jsp:include page="../_meta.jsp"></jsp:include>
    <link href="/lib/easyui/themes/default/easyui.css" rel="stylesheet" type="text/css">
    <link href="/lib/easyui/themes/icon.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>
    </head>

    <script>
        $(function(){

            $("#backSearch").click(function () {
                $.post("SaleBackServlet",{cusId:$(".customer").val()},function (data) {
                    if(data!="false"){
                        $(".easyui-datagrid").datagrid({
                            data:$.parseJSON(data)
                        });
                    }
                })
            })
            $("#backSale").click(function () {
                if(confirm("客户"+$(".customer").val()+"确定退货吗？")){
                    $.post("SaleBackExcuteServlet",{cusId:$(".customer").val()},function (data) {
                        if(data!=null){
                            alert("退货成功")
                            $.post("SaleBackServlet",{cusId:$(".customer").val()},function (data) {
                                if(data!="false"){
                                    $(".easyui-datagrid").datagrid({
                                        data:$.parseJSON(data)
                                    });
                                }
                            })
                        }else {
                            alert("退货失败")
                        }
                    })
                }else {
                    alert("退货取消")
                }

            })

        })
    </script>
    <body>
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 我要退货 <span class="c-gray en"></span>  <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace('sale-back.jsp');" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container "  style="width:1500px;height:100%;margin:20px auto">
        <div id="datetool" style="padding: 10px">
            <input placeholder="客户id" class="customer" value="" style="width: 100px"/>&nbsp;&nbsp;&nbsp;
            <a id="backSearch" href="#" class="easyui-linkbutton" iconCls="icon-search">查找</a>
            &nbsp;&nbsp;&nbsp;
            <a  id="backSale" class="easyui-linkbutton" iconCls="icon-cancel">退货</a>
        </div>

        <table   class="easyui-datagrid" style="width:60%;height:500px;" title="销售单查询" striped="true"
                 data-options="fitColumns:true,singleSelect:true,
               pagination:true,
               toolbar:'#datetool'">
            <thead>
            <tr>
                <th data-options="field:'salesId',width:100">销售单编号</th>
                <th data-options="field:'cusId',width:100">订单客户</th>
                <th data-options="field:'saleDate',width:100">销售日期</th>
                <th data-options="field:'workId',width:100">经办人</th>
                <th data-options="field:'proBarCode',width:100">产品信息</th>
                <th data-options="field:'saleQuantity',width:100">销售数量</th>
                <th data-options="field:'salePrice',width:100">销售价格</th>
                <th data-options="field:'saleDiscount',width:100">销售折扣</th>
                <th data-options="field:'saleTotal',width:100">消费总价</th>
                <th data-options="field:'excuteState',width:100">执行状态</th>
            </tr>

            </thead>

        </table>
    </div>

    <script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
    <script type="text/javascript" src="/static/h-ui/js/H-ui.min.js"></script>
    <script type="text/javascript" src="/static/h-ui.admin/js/H-ui.admin.js"></script>
    <script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
    <script src="/lib/easyui/jquery.easyui.min.js"></script>
    <script src="/lib/easyui/locale/easyui-lang-zh_CN.js"></script>
    <!--请在下方写此页面业务相关的脚本-->
    </body>
    </html>
